﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace DataWasher.WebApi.Repositories.Base
{
    public interface IRepositoryBase<TEntity> where TEntity : class
    {
        int Add(TEntity obj);
        Task<int> AddAsync(TEntity obj);
        Task<TEntity> AddAsyncCallBack(TEntity obj);
        int AddRange(ICollection<TEntity> obj);
        Task<int> AddRangeAsync(ICollection<TEntity> entities);
        TEntity GetById(object id);
        Task<TEntity> GetByIdAsync(object id);
        IQueryable<TEntity> GetMany(Expression<Func<TEntity, bool>> where);
        Task<IEnumerable<TEntity>> GetManyAsync(Expression<Func<TEntity, bool>> where);
        IQueryable<TEntity> GetAll();
        Task<IEnumerable<TEntity>> GetAllAsync();
        int Update(TEntity obj);
        Task<int> UpdateAsync(TEntity obj);
        //int UpdateAndAudit(TEntity obj);
        //Task<int> UpdateAndAuditAsync(TEntity obj);
        int Remove(TEntity obj);
        //int RemoveAndAudit(TEntity obj);
        //Task<int> AlterDataTable(string sql, IEnumerable<object> paras);
        bool HasEntity(out TEntity entity, Expression<Func<TEntity, bool>> where);
        Task<int> UpdateRangeAsync(IEnumerable<TEntity> entities);
        Task<int> RemoveRangeAsync(IEnumerable<TEntity> entities);
    }
}
